package org.star.dolphin.domain;

import lombok.Data;
import org.star.dolphin.utils.DateUtil;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import javax.persistence.Transient;

@Data
public class BaseEntity {

    @Id
    @KeySql(useGeneratedKeys = true)
    private Long id;

    private Long createDate;   //创建时间

    private Long updateDate;   //修改时间

    @Transient
    private Integer page = 1;

    @Transient
    private Integer rows = 10;

    @Transient
    private String createDateShow;

    @Transient
    private String updateDateShow;

    public void setCreateDate(Long createDate) {
        this.createDate = createDate;
        this.createDateShow = DateUtil.timeStamp2DateStr(createDate, null);
    }

    public void setUpdateDate(Long updateDate) {
        this.updateDate = updateDate;
        this.updateDateShow = DateUtil.timeStamp2DateStr(updateDate, null);
    }
}
